package cindy.example.slidingmenu;


import android.os.Bundle;
import android.app.ActivityGroup;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;

public class MainActivity extends ActivityGroup {
	SlidingMenuView slidingMenuView;
	
	ViewGroup tabcontent;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        slidingMenuView = (SlidingMenuView) findViewById(R.id.sliding_menu_view);
        
        tabcontent = (ViewGroup) slidingMenuView.findViewById(R.id.sliding_body);
        showDefaultTab();
    }
    
    public void hideMenu(View view){
    	slidingMenuView.scrollRight();
    }
    
    public void showMenu(View view){
    	slidingMenuView.scrollLeft();
    }
    
    public void changeTab1(View view){
    	Intent i = new Intent(this,TestActivity1.class);
    	View v = getLocalActivityManager().startActivity(TestActivity1.class.getName(), i).getDecorView();
		tabcontent.removeAllViews();
		tabcontent.addView(v);
    }
    
    public void changeTab2(View view){
    	Intent i = new Intent(this,TestActivity2.class);
    	View v = getLocalActivityManager().startActivity(TestActivity2.class.getName(), i).getDecorView();
		tabcontent.removeAllViews();
		tabcontent.addView(v);
    }
    
    void showDefaultTab(){
    	Intent i = new Intent(this,TestActivity1.class);
    	View v = getLocalActivityManager().startActivity(TestActivity1.class.getName(), i).getDecorView();
		tabcontent.removeAllViews();
		tabcontent.addView(v);
    }
}
